﻿package org.xhs.report.common.model
{
    import baidu.wenku.common.*;
    import flash.display.*;

    public class LoaderInfoVO extends Object
    {
        public var docUrl:String;
        public var cdnUrl:String;
        public var domainUrl:String;
        public var docId:String;
        public var docFpn:int;
        public var docNpn:int;
        public var isPPT:Boolean;
        public var docType:String;
        public var docTitle:String;
        public var readerType:String;
        public var hasCatal:int;
        public var bookmark:String;
        public var newmark:String;
        public var bookmarkPage:int = 0;
        public var newmarkPage:int = 0;
        public var newmarkOffset:Number = 0;
        protected var _readertype:String;
        protected var _bookmarkOffset:Number = 0;
        protected const PPTS:Array;

        public function LoaderInfoVO()
        {
            this.PPTS = ["ppt", "pptx", "pps", "pot", "dps"];
            this.init();
            return;
        }// end function

        public function init(param1:LoaderInfo = null) : void
        {
            var _loc_3:Array = null;
            var _loc_2:* = param1 ? (param1.parameters) : ({});
            this.docUrl = _loc_2["docurl"] || "http://wenku.baidu.com/play";
            this.cdnUrl = _loc_2["cdnurl"];
            this.docType = ((_loc_2["ext"] || _loc_2["doctype"] || Config.docType) as String).toLowerCase();
            this.docId = _loc_2["docid"] || (this.docType == "txt" ? ("4e00dcd033d4b14e8524688f") : ("31e5832c2af90242a895e5e8"));
            this.docFpn = int(_loc_2["fpn"]) || (this.docType == "txt" ? (50) : (5));
            this.docNpn = int(_loc_2["npn"]) || (this.docType == "txt" ? (50) : (5));
            this.docTitle = _loc_2["title"] || "百度文库";
            this.hasCatal = int(_loc_2["catal"]) || 0;
            this.bookmark = _loc_2["bookmark"] as String || "0|0";
            this.newmark = _loc_2["newmark"] as String || "0|0";
            this._readertype = _loc_2["readertype"] || Config.READER_TYPE_EXTERNAL;
            this.isPPT = this.PPTS.indexOf(this.docType) != -1;
            this.domainUrl = this.docUrl.substr(0, this.docUrl.indexOf("play"));
            _loc_3 = this.bookmark.split("|");
            this.bookmarkPage = int(_loc_3[0]);
            this._bookmarkOffset = _loc_3.length > 1 ? (Number(_loc_3[1])) : (0);
            _loc_3 = this.newmark.split("|");
            this.newmarkPage = int(_loc_3[0]);
            this.newmarkOffset = _loc_3.length > 1 ? (Number(_loc_3[1])) : (0);
            Config.isAPIViewer = this._readertype == Config.READER_TYPE_EXTERNAL;
            return;
        }// end function

        public function get readertype() : String
        {
            return this._readertype;
        }// end function

        public function get bookmarkOffset() : Number
        {
            return this._bookmarkOffset;
        }// end function

    }
}
